home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 10
/
FM Towns Free Software Collection 10.iso
/
tos_updt
/
fmcity
/
palcom
/
auto
/
script
/
formsel.mx
< prev
next >
Wrap
Text File
|
1995-04-17
|
12KB
|
377 lines
//--------------------------------------------------------------------------//
// PALCOM V2.1 L10 //
// 自動通信:巡回フォーラム選択ダイアログスクリプト //
// //
// CopyRight(C) 1994/10/20 //
// FUJITSU PERSONAL COMPUTER SYSTEMS LIMITED //
// written by C-cube Soft T.Nakamura //
//--------------------------------------------------------------------------//
event @OPEN.EXTERN {
//--- データの取得 ---//
$topList = Auto.getForumTop();
$forumNum = list.get1st( $topList );
$topList = list.getNth( $topList, 2 );
$SetStatusList = list.getNth( $topList, 1 );
$StatusList = list.getNth( $topList, 2 );
$NameList = list.getNth( $topList, 3 );
$CmdList = list.getNth( $topList, 4 );
$TagList = list.getNth( $topList, 5 );
$chkNumList = list.getNth( $topList, 6 );
$i = 1;
$ListNameList = [];
foreach( $a, $NameList ) {
if( list.getNth( $StatusList, $i ) == #TRUE ) {
$mark = "■";
} elif( list.getNth( $SetStatusList, $i ) == #TRUE ) {
$mark = "□";
} else {
$mark = " ";
}
list.putLast( $ListNameList, str.join([$mark,$a], "" ));
$i = $i + 1;
}
$defList = [1];
sys.global( $NameList );
sys.global( $StatusList );
sys.global( $SetStatusList );
sys.global( $ListNameList );
sys.global( $TagList );
//--- フォーラムが1件も登録されていない場合 ---//
//--- 直接新規登録を行う。 ---//
if( list.size( $NameList ) == 0 ) {
$dataList = ["","",[-1,-1,-1],#FALSE,#TRUE];
AUTO.setForumData( $dataList, time.get());
$path = str.join([$$DIR.STANDARD, "AUTO\\SCRIPT\\FORMEDIT.MX"], "" );
script.openExtern( $path, #FALSE, [] );
if( AUTO.getDialogReturn() != 1 ) {
AUTO.setDialogReturn( 0 );
return;
} else {
AUTO.updateForumData( $topList, -1 );
Auto.setListName( -1 );
}
}
//--- ボタンの設定 ---//
$newBtnId = dialog.makeButton( 1, "新規登録", 0, 0 );
$editBtnId = dialog.makeButton( 1, "編集", 0, 0 );
$loopBtnId = dialog.makeButton( 1, "巡回", 0, 0 );
$delBtnId = dialog.makeButton( 1, "削除", 0, 0x007F );
$setBtnId = dialog.makeButton( 1, "設定", 0, 0x8012 );
$canBtnId = dialog.makeButton( 1, "取消", 0, 0x8011 );
//--- ダイアログデータの設定 ---//
$dialogList = ["巡回フォーラムの設定", 0, -1, -1, $setBtnId,
["", 1028, [60,10,0], $ListNameList, $defList ],
["", $canBtnId, [0], [""], [""] ],
["", $setBtnId, [0], [""], [""] ],
["", $delBtnId, [0], [""], [""] ],
["", $loopBtnId, [0], [""], [""] ],
["", $editBtnId, [0], [""], [""] ],
["", $newBtnId, [0], [""], [""] ]];
//--- メインループ ---//
loop {
//--- ダイアログの表示 ---//
sys.pushCursor( 80 );
dialog.open( $dialogList );
sys.popCursor();
//--- ボタンの処理 ---//
$btnId = list.get1st( $$DIALOG.RETURN );
$no = list.get1st( list.getNth( $$DIALOG.RETURN, 2 ));
//--- 選択されていなくては実行出来ない物のチェック ---//
if(( $btnId == $loopBtnId )||( $btnId == $editBtnId )||
( $btnId == $delBtnId )) {
if(( $no == -1 )||( list.size( $NameList ) == 0 )) {
continue;
}
}
$exitFlg = 0;
table( $btnId ) {
else { $exitFlg = 1; }
$canBtnId { $exitFlg = 1; }
$setBtnId { $exitFlg = 1; }
$newBtnId {
if( $forumNum == AUTO.getForumMax()) {
$saveXsize = dialog.getDefaultXSize();
dialog.setDefaultXSize( 328 );
sys.pushCursor( 80 );
$ret = dialog.ask([
"━━━━━━ フォーラムの新規登録 ━━━━━━",
"",
" 登録可能なフォーラムの最大数を超えました。 ",
" さらにフォーラムを登録する場合は、一度自動通信を",
"終了させ、再度設定を行ってください。 ",
""], ["確認"] );
sys.popCursor();
dialog.setDefaultXSize( $saveXsize );
exit;
}
$dataList = ["","",[-1,-1,-1],#FALSE,#TRUE];
AUTO.setForumData( $dataList, time.get());
$path = str.join([$$DIR.STANDARD,
"AUTO\\SCRIPT\\FORMEDIT.MX"], "" );
script.openExtern( $path, #FALSE, [] );
if( AUTO.getDialogReturn() == 1 ) {
AUTO.updateForumData( $topList, -1 );
Auto.setListName( -1 );
$forumNum = $forumNum + 1;
}
}
$editBtnId {
$dataList = [list.getNth( $NameList, $no ),
list.getNth( $CmdList, $no ),
list.getNth( $TagList, $no ),
list.getNth( $SetStatusList, $no ),
list.getNth( $StatusList, $no )];
AUTO.setForumData( $dataList, list.getNth( $chkNumList, $no ));
$path = str.join([$$DIR.STANDARD,
"AUTO\\SCRIPT\\FORMEDIT.MX"], "" );
script.openExtern( $path, #FALSE, [] );
if( AUTO.getDialogReturn() == 1 ) {
AUTO.updateForumData( $topList, $no );
Auto.setListName( $no );
}
}
$loopBtnId {
if( list.getNth( $SetStatusList, $no ) == #FALSE ) {
exit;
}
if( list.getNth( $StatusList, $no ) == #FALSE ) {
list.delNth( $StatusList, $no );
list.putNth( $StatusList, $no-1, #TRUE );
} else {
list.delNth( $StatusList, $no );
list.putNth( $StatusList, $no-1, #FALSE );
}
Auto.setListName( $no );
list.del1st( $defList );
list.put1st( $defList, $no );
$upDateFlg = 1;
}
$delBtnId {
if(( $ret = DelAuto( $no )) == 0 ) {
exit;
}
if( $ret == 1 ) {
list.del1st( $defList );
list.put1st( $defList, $no );
} else {
$forumNum = $forumNum - 1;
if( $no != 1 ) {
list.del1st( $defList );
list.put1st( $defList, $no - 1 );
}
}
$upDateFlg = 1;
}
}
if( $exitFlg == 1 ) {
exit;
}
}
//--- 復帰値の設定&後始末 ---//
if( $btnId == $setBtnId ) {
if( $upDateFlg == 1 ) {
AUTO.setLoopStatus( $StatusList, $TagList );
}
$btnId = 1;
} elif( $btnId == $canBtnId ) {
$btnId = 0;
} else {
$btnId = -1;
}
AUTO.setDialogReturn( $btnId );
sys.local( $TagList );
sys.local( $ListNameList );
sys.local( $StatusList );
sys.local( $SetStatusList );
sys.local( $NameList );
dialog.delButton( $newBtnId );
dialog.delButton( $editBtnId );
dialog.delButton( $loopBtnId );
dialog.delButton( $delBtnId );
dialog.delButton( $setBtnId );
dialog.delButton( $canBtnId );
return;
}
event @CLOSE.EXTERN {
return;
}
event @ERROR {
local.errorFunc();
event.mainLoop();
}
//--------------------------------------------//
//--- 自動通信設定の削除ダイアログ制御 ---//
//--------------------------------------------//
function DelAuto( $no ) {
$str = str.join(["【", list.getNth( $NameList, $no ),"】",
"の設定を削除します。"], "" );
$setBtnId = dialog.makeButton( 1, "実行", 0, 0x8012 );
$canBtnId = dialog.makeButton( 1, "取消", 0, 0x8011 );
$dialogList = ["", 0, -1, -1, $setBtnId,
["", 1024, [0], [
"━━━━━━━━━━ フォーラム設定の削除 ━━━━━━━━━━"],
[""]],
["", 1024, [0], [""], [""]],
["", 1024, [2], [$str], [""]],
["", 1024, [0], [""], [""]],
["", 1026, [1], ["フォーラムの登録情報を削除する"],[#FALSE]],
["", 1024, [0], [""], [""]],
["", 1024, [0], [
" フォーラムの登録情報を削除すると、他の自動通信設定で指定",
" されている同フォーラムへの巡回も行われなくなります。 "],
[""]],
["", 1024, [0], [""], [""]],
["", $canBtnId, [0], [""], [""]],
["", $setBtnId, [0], [""], [""]]
];
$saveXsize = dialog.getDefaultXSize();
dialog.setDefaultXSize( 408 );
sys.pushCursor( 80 );
dialog.open( $dialogList );
sys.popCursor();
dialog.setDefaultXSize( $saveXsize );
dialog.delButton( $canBtnId );
dialog.delButton( $setBtnId );
$btnId = list.get1st( $$DIALOG.RETURN );
if( $btnId == $setBtnId ) {
$delFlg = list.get1st( list.getNth( $$DIALOG.RETURN, 6 ));
AUTO.delForumData( list.getNth( $TagList, $no ), $delFlg );
if( $delFlg == #FALSE ) {
list.delNth( $StatusList, $no );
list.putNth( $StatusList, $no - 1, #FALSE );
list.delNth( $SetStatusList, $no );
list.putNth( $SetStatusList, $no - 1, #FALSE );
list.delNth( $ListNameList, $no );
list.putNth( $ListNameList, $no - 1,
str.join( [" ", list.getNth( $NameList, $no )], "" ));
return( 1 );
} else {
list.delNth( $StatusList, $no );
list.delNth( $SetStatusList, $no );
list.delNth( $ListNameList, $no );
list.delNth( $NameList, $no );
list.delNth( $TagList, $no );
return( 2 );
}
}
return( 0 );
}
//----------------------------------------//
//--- リストに表示する文字列の設定 ---//
//----------------------------------------//
function Auto.setListName( $no ) {
if( list.getNth( $StatusList, $no ) == #TRUE ) {
$mark = "■";
} elif( list.getNth( $SetStatusList, $no ) == #TRUE ) {
$mark = "□";
} else {
$mark = " ";
}
$str = str.join( [$mark, list.getNth( $NameList, $no )], "" );
if( $no == -1 ) {
list.putLast( $ListNameList, $str );
} else {
list.delNth( $ListNameList, $no );
list.putNth( $ListNameList, $no-1, $str );
}
return;
}
//------------------------------------//
//--- フォーラム巡回情報の取得 ---//
//------------------------------------//
function Auto.getForumTop() {
$nameList = [];
$cmdList = [];
$statusList1 = [];
$statusList2 = [];
$chkNumList = [];
$tagList = [];
$tag = [1, 2, -5, -2];
//--- データベースに登録されているフォーラムの個数を調べる ---//
$TrdId = AUTO.getTrdId();
$num = trd.count( $TrdId, $tag );
if( $num == 0 ) {
return( [0, [[],[],[],[],[],[]]] );
}
//--- フォーラム情報の読み込み ---//
$SetDataList = AUTO.getSetData();
if( dialog.check() == #FALSE ) {
$dlgFlg = #TRUE;
dialog.openProg([[],"フォーラム情報を読み込んでいます",[],""],
"", #TRUE );
} else {
$dlgFlg = #FALSE;
}
$cnt = 0;
loop {
$retList = trd.getData( $TrdId, $tag );
if( list.get1st( $retList ) == 0 ) {
exit;
}
$wkList = str.split( list.getNth( $retList, 2 ), "\t" );
$chkNum = data.toNumber( list.getNth( $wkList, 3 ));
$forumId = list.getNth( list.getNth( $retList, 3 ), 3 );
$status1 = #FALSE;
$status2 = #FALSE;
foreach( $a, list.getNth( $SetDataList, 2 )) {
if(( $forumId == list.getNth( list.get1st( $a ), 3 ))&&
( $chkNum == list.getNth( list.getNth( $a, 2 ), 4 ))) {
$status1 = #TRUE;
$status2 = list.get1st( list.get1st( list.get1st(
list.getNth( $a, 2 ))));
exit;
}
}
list.putLast( $cmdList, list.getNth( $wkList, 1 ));
list.putLast( $nameList, list.getNth( $wkList, 2 ));
list.putLast( $chkNumList, $chkNum );
list.putLast( $statusList1, $status1 );
list.putLast( $statusList2, $status2 );
$tag = list.getNth( $retList, 3 );
loop {
if( list.getLast( $tag ) <= 0 ) {
list.delLast( $tag );
continue;
}
exit;
}
list.putLast( $tagList, $tag );
$tag = [];
$cnt = $cnt + 1;
if( $dlgFlg == #TRUE ) {
dialog.updateProg( $cnt * 100 / $num );
}
}
if( $dlgFlg == #TRUE ) {
dialog.close();
}
return( [$num, [$statusList1,$statusList2,$nameList,
$cmdList,$tagList,$chkNumList]] );
}